package com.heima.media.controller;
import com.heima.common.dto.ResponseResult;

import com.heima.media.dto.WmMaterialDto;
import com.heima.media.service.IWmMaterialService;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
/**
 * @BelongsProject: heima-leadnews
 * @BelongsPackage: com.heima.media.controller
 * @Author: wangjian
 * @CreateTime: 2022-07-01  20:00
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/v1/material")
@Api(tags = "自媒体图文素材信息表接口")
@CrossOrigin
public class WmMaterialController{

    @Autowired
    private IWmMaterialService wmMaterialService;

    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping("/upload_picture")
    public ResponseResult upload(MultipartFile file) {
        return wmMaterialService.upload(file);
    }
/**
 * @description:根据收藏状态分页查询列表
 * @author: wangjian
        * @date: 2022/7/1 20:14
 * @param: dto
 * @return: com.heima.common.dto.ResponseResult
 **/
    @PostMapping("/list")
    public ResponseResult list(@RequestBody WmMaterialDto dto){
        return wmMaterialService.list(dto);
    }
}

